﻿package org.bao.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092200567832";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVO86wtBvf4e5ucRFKQinxLxpV7vTq5zKujSHN9tfKuiUVKmNa8lHDAqhs4zrctMOZVcaJ67Qt7f4X/HZdqDBiSYG8tzWGConuyhhWdT5m9OAJ4roGf0eDT3itjq+K7Wnctrl1MCYyJMqgDJxL7HkTcZhBmX7Sfnp+14EtrK0Fe5iwmWbnlFz4U6oSpyD93mi9a0MynYXqlwsJQv/tXzhpS7HwpXLPsRz0m/WLyGsSf9GHZIbvSDC70zifHEu9X5n4gy9Ux3eDeCtiy9Zey1Dj5j6YoCoLdUCee2Rc7VPbukGbYB9JnaVRf35hFAEkIXl7syNwd5O17Hc1Ym9qrdalAgMBAAECggEAYMKnkIEndbFrRGbBfDGMOlp9K+zFFq4TeYP+wCnl3wd01dVnGGf3xYaqp/dpigMWtAwer/yJFiKy1uCV6sILpR7eJPtxk9iveInG4AAjFuR9g0tjrKTIPIbBy16xyVWIh1hexXITwf2C9+VVThEkrAvCWf5pcZgaWrXmhzPn954fXMTgFjqgLmKoLUxLrUKkqv6jmpjosHzSluLV9p3q41mDPiG62KKPYPdIMUjOUghg3ZnhBjQHu5Tzk/eUS6zXU3k8qpU1dS8Nz3zAUY8ksz0nkpt8EQDYjYG7JqZuiuWkvc8JHdXMI4S2p4NV6rHLkz0Wb5cPnAPOm2LKFJxs/QKBgQDJbboEjY/89bm115u0uC1HX+8unRnLx9MIrAuzTZ973/7j2yqXNdigxfCtAM88/jlXrK7xROMNYFUyRmohFxWPj7OBOaMd2KDcm9hv+jJ/zlmjTn/qig6VQ3nLVnUYUeTVHoC1khCQKL40eZ+bdD4YNweDYJAkJQpIwY32zDdRhwKBgQC9qgwQGq7av2ejzbVw7QPafSXRVLSoEmfvnhj5B/MnGLF6K6TwcZAw1JesL17aKiPdoGZGKNTVSCxtfifOTFL/xjS9mJ2Or9H7aZ8cr+UICZ2ULRA2dztwqA1Y/o5SxeQaCJCL4HbSe+Hcu35p1O2/HKz28yDAfKN8jZ5ZntPRcwKBgCKXpIWZpivEK4OOJqBvrN8AG7x+oGp9w8FOgqflYclNW6HYBsV3Kt/Zfo7Hf8+yvThQYK7wrKmkbJ04uIs8Qqin/iToOBotFNsuLIp2hmuqjXxdQ9yMnxqFPwprq6pkjg8HsQT9s7h+NsQeSwnQecWA1dp7H+YFMnHyQ6YpxipLAoGBAK6jelIFz8VaAxtAGfauNyMiowTaAzLTJ+LqZ0I/ALSaNykwMMK5PrTHvBTu1V76+GVlAWdOx5LPzyDOzeZWPwKGxh9h/Ina+PWPrtOiXriE6hT7XXdZWGEGTKwKUJCE6ODTzA0QFTkAmts9xUu7pWKZC+ajvh+fZIYWfJ028wFjAoGAZslJUl0g2iAbRH0D6bUXOFUSClD9uS8aUz51Ed09UW+FoHYv4XaoqqVA8EtahvwObH2SudM7f51fpzp1mCGpUpt1cqYVNejj92PhOnHUFDGNSDkKbCKyjRx2O0Sgna4XoNIbhqB2vyrtE+2U0gXv1vNUZbnbluWvhVXCEGqXC0E=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1/WH9TsG5jGuQ6qA1+mSc1Pw7Fv9gzV5AEtCymU5Zyc7qQrFPkVTzLnQKa9GPlaJ785W10zgwRYL9gFxwkubJCeBmD9SzJxmKcXi0EZXStJuKKaEnNSDMIDK/Qv5x7j9JFZVe8hiMRrj2F4xqJHC+7vdN2oyWAhGL2U0cQYk2t0iO2mpgp6w/mkNhMaNJRzt2BytXLdT+RW1n3CFLdKDdEHe2ow3XCNseLr9ko1Y8+TpYcVjNa2So9pPeCW8re7UG/xdZVGE3om7HNpzVSu5I3gMMorW4K335dBcHBPssJ1rZjB8LFReB9wwWJWSTbsJ/yQrzuPsUQvQVowGJx9VjwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://59.110.136.66:8080/phoneO2O/${basePath }jump?pg=alipay/notify_url";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://59.110.136.66:8080/phoneO2O/${basePath }jump?pg=alipay/return_url";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "E:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

